"inequality", "inequality.variable", "union.self", "union.other",
"employed", "occupation", "hhsize", "educ", "income",
"age", "race", "party", "ideology", "gender", "religion")]
## save dataset in folder (i.e. working directory must be set to folder)
saveRDS(survey_2236, file = "survey_2236.rds")
summary(survey$q8.b)
summary(survey$Q8_B)
survey$inequality <- survey$Q8_B
survey$inequality <- recode(survey$inequality,
`Do not feel` = "Don't Feel",
`Do feel` = "Feel",
`Not sure` = "Not Sure")
summary(survey$inequality)
is.ordered(survey$inequality)
class(survey$inequality)
survey$inequality.variable <- 1
class(survey$inequality.variable)
survey$union.self <- survey$F6.1
summary(survey$union.self)
survey$union.self <- survey$F6_1
summary(survey$union.self)
survey$union.other <- survey$F6_2
summary(survey$union.other)
summary(survey$F2A)
survey$employed <- survey$F2A
class(survey$employed)
summary(survey$F2B)
survey$occupation <- survey$F2B
class(survey$occupation)
survey$hhsize <- NA
summary(survey$F5)
survey$educ <- survey$F5
summary(survey$educ)
levels(survey$educ)
levels(survey$educ)[6]
levels(survey$educ)[5]
survey$educ <- recode(survey$educ,
`No formal schooling (0 years)` = "Less than high school",
`Frst thrgh svnth grd (1-7 yrs f schl c` = "Less than high school",
`8th grd (8 yrs f schl cmpltd)` = "Less than high school",
`Some high school (9-11 years of school` = "Less than high school",
`High school graduate (12 years of scho` = "High school graduate",
`Sm cllg (1-3 yrs f cllg cmpltd)` = "Some college",
`Tw yr cllg grdt (cmpltd 2 yrs cmmnty c` = "Some college",
`Fr yr cllg grdt (cmpltd 4 yrs f cllg)` = "College graduate",
`Post graduate (4 year college graduate` = "Post graduate")
class(survey$educ)
summary(survey$educ)
survey$educ <- as.ordered(survey$educ)
summary(survey$educ)
summary(survey$F7)
survey$income <- survey$F7
summary(survey$income)
class(survey$income)
summary(survey$F4)
survey$age <- survey$F4
summary(survey$age)
summary(survey$F10)
survey$race <- survey$F10
summary(survey$race)
survey$party <- survey$Q1D
summary(survey$party)
class(survey$party)
survey$ideology <- NA
summary(survey$ideology)
summary(survey$F11)
survey$gender <- survey$F11
table(survey$gender)
survey$religion <- survey$F8
summary(survey$religion)
class(survey$pid)
survey$pid
summary(survey$urban)
summary(survey$region)
summary(survey$inequality)
summary(survey$employed)
summary(survey$occupation)
summary(survey$educ)
summary(survey$income)
summary(survey$age)
summary(survey$race)
class(survey$party)
summary(survey$party)
table(survey$gender)
summary(survey$religion)
survey <- read.dta13("harris_s2343_public_spss.dta")
## pid
survey$pid <- c(1:nrow(survey))
class(survey$pid)
## study number
survey$study <- 2343
class(survey$study)
## year
survey$year <- 1973
class(survey$year)
## geographpic data
survey$urban <- survey$S13
survey$urban <- recode(survey$urban, `Central City` = "Urban",
`Suburb` = "Suburban",
`Town` = "Rural")
summary(survey$urban)
## region
survey$region <- survey$S11
survey$region <- recode(survey$region, `East_(1)` = "East",
`East_(2)` = "East", `South_(3)` = "South",
`South_(4)` = "South", `Midwest_(5)` = "Midwest",
`Midwest_(6)` = "Midwest", `West_(7)` = "West",
`West_(8)` = "West")
summary(survey$region)
## respondent name
survey$hh <- NA
## inequality increasing
summary(survey$Q8_B)
survey$inequality <- survey$Q8_B
survey$inequality <- recode(survey$inequality,
`Do not feel` = "Don't Feel",
`Do feel` = "Feel",
`Not sure` = "Not Sure")
summary(survey$inequality)
class(survey$inequality)
is.ordered(survey$inequality)
## inequality variable version
survey$inequality.variable <- 1
class(survey$inequality.variable)
## union
survey$union.self <- survey$F6_1
survey$union.other <- survey$F6_2
summary(survey$union.other)
## Are you employed? what kind of employment?
summary(survey$F2A)
survey$employed <- survey$F2A
summary(survey$employed)
## Occupation
summary(survey$F2B)
survey$occupation <- survey$F2B
summary(survey$occupation)
## household size
survey$hhsize <- NA
## Education
summary(survey$F5)
survey$educ <- survey$F5
summary(survey$educ)
levels(survey$educ)[5]
survey$educ <- recode(survey$educ,
`No formal schooling (0 years)` = "Less than high school",
`Frst thrgh svnth grd (1-7 yrs f schl c` = "Less than high school",
`8th grd (8 yrs f schl cmpltd)` = "Less than high school",
`Some high school (9-11 years of school` = "Less than high school",
`High school graduate (12 years of scho` = "High school graduate",
`Sm cllg (1-3 yrs f cllg cmpltd)` = "Some college",
`Tw yr cllg grdt (cmpltd 2 yrs cmmnty c` = "Some college",
`Fr yr cllg grdt (cmpltd 4 yrs f cllg)` = "College graduate",
`Post graduate (4 year college graduate` = "Post graduate")
class(survey$educ)
summary(survey$educ)
survey$educ <- as.ordered(survey$educ)
## Income
summary(survey$F7)
survey$income <- survey$F7
summary(survey$income)
class(survey$income)
## Age
summary(survey$F4)
survey$age <- survey$F4
summary(survey$age)
## race
summary(survey$F10)
survey$race <- survey$F10
summary(survey$race)
## politics
survey$party <- survey$Q1D
summary(survey$party)
class(survey$party)
## ideology
survey$ideology <- NA
summary(survey$ideology)
## gender
summary(survey$F11)
survey$gender <- survey$F11
table(survey$gender)
## religion
survey$religion <- survey$F8
summary(survey$religion)
### put together data set
survey_2343 <- survey[,c("pid", "study", "year", "urban", "region", "hh",
"inequality", "inequality.variable", "union.self", "union.other",
"employed", "occupation", "hhsize", "educ", "income",
"age", "race", "party", "ideology", "gender", "religion")]
saveRDS(survey_2343, file = "survey_2343.rds")
setwd("~/")
setwd("~/Dropbox/Perception_Inequality_wHannah/Survey Files/Harris 1974 Watergate Survey, study no. 2434")
survey <- read.dta13("harris_s2434_spss.dta")
View(survey)
survey$pid <- c(1:nrow(survey))
class(survey$pid)
survey$study <- 2434
class(survey$study)
survey$year <- 1974
survey$urban <- survey$S13
summary(survey$urban)
survey$urban <- recode(survey$urban, `Central City` = "Urban",
`Suburb` = "Suburban",
`Town` = "Rural")
summary(survey$urban)
survey$region <- survey$S11
summary(survey$region)
survey$region <- recode(survey$region, `East_(1)` = "East",
`East_(2)` = "East", `South_(3)` = "South",
`South_(4)` = "South", `Midwest_(5)` = "Midwest",
`Midwest_(6)` = "Midwest", `West_(7)` = "West",
`West_(8)` = "West")
summary(survey$region)
summary(survey$F1)
survey$hh <- recode(survey$F1, `Male head` = "Yes", `Female head (no male head)` = "Yes",
`Wife` = "No", `Son` = "No", `Daughter` = "No", `Other (specify)` = "No")
summary(survey$hh)
summary(survey$Q7_B)
survey$inequality <- recode(survey$inequality,
`Don t Feel` = "Don't Feel")
survey$inequality <- survey$Q7_B
survey$inequality <- recode(survey$inequality,
`Don t Feel` = "Don't Feel")
summary(survey$inequality)
class(survey$inequality)
is.ordered(survey$inequality)
survey$inequality.variable <- 1
class(survey$inequality.variable)
survey$union.self <- survey$F6_1
survey$union.other <- survey$F6_2
summary(survey$union.other)
summary(survey$union.self)
summary(survey$F2A)
survey$employed <- survey$F2A
summary(survey$employed)
summary(survey$F2B)
survey$occupation <- survey$F2B
summary(survey$occupation)
survey$hhsize <- NA
summary(survey$F5)
survey$educ <- recode(survey$educ,
`C No formal schooling (0 years)` = "Less than high school",
`D Frst thrgh svnth grd (1-7 yrs f schl c` = "Less than high school",
`E 8th grd (8 yrs f schl cmpltd)` = "Less than high school",
`F Sm hgh schl (9-11 yrs f schl cmpltd)` = "Less than high school",
`G Hgh schl grdt (12 yrs f schl cmpltd)` = "High school graduate",
`H Sm cllg (1-3 yrs f cllg cmpltd)` = "Some college",
`I Tw yr cllg grdt (cmpltd 2 yrs cmmnty c` = "Some college",
`J Fr yr cllg grdt (cmpltd 4 yrs f cllg)` = "College graduate",
`K Post graduate (4 year college graduate` = "Post graduate")
survey$educ <- survey$F5
survey$educ <- recode(survey$educ,
`C No formal schooling (0 years)` = "Less than high school",
`D Frst thrgh svnth grd (1-7 yrs f schl c` = "Less than high school",
`E 8th grd (8 yrs f schl cmpltd)` = "Less than high school",
`F Sm hgh schl (9-11 yrs f schl cmpltd)` = "Less than high school",
`G Hgh schl grdt (12 yrs f schl cmpltd)` = "High school graduate",
`H Sm cllg (1-3 yrs f cllg cmpltd)` = "Some college",
`I Tw yr cllg grdt (cmpltd 2 yrs cmmnty c` = "Some college",
`J Fr yr cllg grdt (cmpltd 4 yrs f cllg)` = "College graduate",
`K Post graduate (4 year college graduate` = "Post graduate")
class(survey$educ)
summary(survey$educ)
survey$educ <- as.ordered(survey$educ)
class(survey$educ)
summary(survey$F7)
survey$income <- survey$F7
summary(survey$income)
class(survey$income)
summary(survey$F4)
survey$age <- survey$F4
summary(survey$age)
summary(survey$F10)
survey$race <- survey$F10
summary(survey$race)
survey$party <- survey$Q4_A
summary(survey$party)
survey$party <- survey$Q4A
summary(survey$party)
class(survey$party)
summary(survey$F11)
survey$gender <- survey$F11
table(survey$gender)
survey$religion <- survey$F8
summary(survey$religion)
survey_2434 <- survey[,c("pid", "study", "year", "urban", "region", "hh",
"inequality", "inequality.variable", "union.self", "union.other",
"employed", "occupation", "hhsize", "educ", "income",
"age", "race", "party", "ideology", "gender", "religion")]
survey <- read.dta13("harris_s2434_spss.dta")
## pid
survey$pid <- c(1:nrow(survey))
class(survey$pid)
## study number
survey$study <- 2434
class(survey$study)
## year
survey$year <- 1974
class(survey$year)
## geographpic data
survey$urban <- survey$S13
survey$urban <- recode(survey$urban, `Central City` = "Urban",
`Suburb` = "Suburban",
`Town` = "Rural")
summary(survey$urban)
## region
survey$region <- survey$S11
survey$region <- recode(survey$region, `East_(1)` = "East",
`East_(2)` = "East", `South_(3)` = "South",
`South_(4)` = "South", `Midwest_(5)` = "Midwest",
`Midwest_(6)` = "Midwest", `West_(7)` = "West",
`West_(8)` = "West")
summary(survey$region)
## respondent name
summary(survey$F1)
survey$hh <- recode(survey$F1, `Male head` = "Yes", `Female head (no male head)` = "Yes",
`Wife` = "No", `Son` = "No", `Daughter` = "No", `Other (specify)` = "No")
summary(survey$hh)
## inequality increasing
summary(survey$Q7_B)
survey$inequality <- survey$Q7_B
survey$inequality <- recode(survey$inequality,
`Don t Feel` = "Don't Feel")
summary(survey$inequality)
class(survey$inequality)
is.ordered(survey$inequality)
## inequality variable version
survey$inequality.variable <- 1
class(survey$inequality.variable)
## union
survey$union.self <- survey$F6_1
survey$union.other <- survey$F6_2
summary(survey$union.self)
## Are you employed? what kind of employment?
summary(survey$F2A)
survey$employed <- survey$F2A
summary(survey$employed)
## Occupation
summary(survey$F2B)
survey$occupation <- survey$F2B
summary(survey$occupation)
## household size
survey$hhsize <- NA
## Education
summary(survey$F5)
survey$educ <- survey$F5
survey$educ <- recode(survey$educ,
`C No formal schooling (0 years)` = "Less than high school",
`D Frst thrgh svnth grd (1-7 yrs f schl c` = "Less than high school",
`E 8th grd (8 yrs f schl cmpltd)` = "Less than high school",
`F Sm hgh schl (9-11 yrs f schl cmpltd)` = "Less than high school",
`G Hgh schl grdt (12 yrs f schl cmpltd)` = "High school graduate",
`H Sm cllg (1-3 yrs f cllg cmpltd)` = "Some college",
`I Tw yr cllg grdt (cmpltd 2 yrs cmmnty c` = "Some college",
`J Fr yr cllg grdt (cmpltd 4 yrs f cllg)` = "College graduate",
`K Post graduate (4 year college graduate` = "Post graduate")
class(survey$educ)
summary(survey$educ)
survey$educ <- as.ordered(survey$educ)
## Income
summary(survey$F7)
survey$income <- survey$F7
summary(survey$income)
class(survey$income)
## Age
summary(survey$F4)
survey$age <- survey$F4
summary(survey$age)
## race
summary(survey$F10)
survey$race <- survey$F10
summary(survey$race)
## politics
survey$party <- survey$Q4A
summary(survey$party)
class(survey$party)
## ideology
survey$ideology <- NA
summary(survey$ideology)
## gender
summary(survey$F11)
survey$gender <- survey$F11
table(survey$gender)
## religion
survey$religion <- survey$F8
summary(survey$religion)
### put together data set
survey_2434 <- survey[,c("pid", "study", "year", "urban", "region", "hh",
"inequality", "inequality.variable", "union.self", "union.other",
"employed", "occupation", "hhsize", "educ", "income",
"age", "race", "party", "ideology", "gender", "religion")]
saveRDS(survey_2434, file = "survey_2434.rds")
setwd("~/Dropbox/Perception_Inequality_wHannah/Survey Files/Harris 1976 ABC Presidential Election Survey, study no. 2624A-1")
setwd("~/Dropbox/Perception_Inequality_wHannah/Survey Files/Harris 1976 ABC Presidential Election Survey, study no. 2624A-1")
survey <- read.dta13("harris_s2624a1_spss.dta")
View(survey)
setwd("~/Dropbox/Perception_Inequality_wHannah/Survey Files/Harris 1976 ABC Presidential Election Survey, study no. 2624A-1")
## packages
require("SASxport")
require("dplyr")
require("readstata13")
## download data
survey <- read.dta13("harris_s2624a1_spss.dta")
## pid
survey$pid <- c(1:nrow(survey))
class(survey$pid)
## study number
survey$study <- 2434
class(survey$study)
## year
survey$year <- 1974
class(survey$year)
## geographpic data
survey$urban <- survey$S13
survey$urban <- recode(survey$urban, `Central City` = "Urban",
`Suburb` = "Suburban",
`Town` = "Rural")
summary(survey$urban)
## region
survey$region <- survey$S11
survey$region <- recode(survey$region, `East_(1)` = "East",
`East_(2)` = "East", `South_(3)` = "South",
`South_(4)` = "South", `Midwest_(5)` = "Midwest",
`Midwest_(6)` = "Midwest", `West_(7)` = "West",
`West_(8)` = "West")
summary(survey$region)
## respondent name
survey$hh <- NA
## inequality increasing
summary(survey$Q11A_2)
survey$inequality <- recode(survey$Q11A_2,
`Don t feel` = "Don't Feel",
`Not sure` = "Not Sure")
summary(survey$inequality)
class(survey$inequality)
is.ordered(survey$inequality)
## inequality variable version
survey$inequality.variable <- 1
class(survey$inequality.variable)
## union
survey$union.self <- survey$F2_1
survey$union.other <- survey$F2_2
summary(survey$union.self)
summary(survey$union.other)
survey[survey$F2_4 == "Yes", c("union.self", "union.other", "F2_3")]
survey$union.other <- as.character(survey$union.other)
survey$union.self <- as.character(survey$union.self)
survey$union.self[survey$F2_4 == "Yes"] <- "Not Sure"
survey$union.other[survey$F2_4 == "Yes"] <- "Not Sure"
survey$union.other <- factor(survey$union.other)
survey$union.self <- factor(survey$union.self)
summary(survey$union.other)
summary(survey$union.self)
## Are you employed? what kind of employment?
summary(survey$F3A)
survey$employed <- survey$F3A
summary(survey$employed)
## Occupation
summary(survey$F3B)
survey$occupation <- survey$F3B
summary(survey$occupation)
## household size
survey$hhsize <- NA
## Education
summary(survey$F1)
survey$educ <- survey$F1
survey$educ <- recode(survey$educ,
`C No formal schooling (0 years)` = "Less than high school",
`D Frst thrgh svnth grd (1-7 yrs f schl c` = "Less than high school",
`E 8th grd (8 yrs f schl cmpltd)` = "Less than high school",
`F Sm hgh schl (9-11 yrs f schl cmpltd)` = "Less than high school",
`G Hgh schl grdt (12 yrs f schl cmpltd)` = "High school graduate",
`H Sm cllg (1-3 yrs f cllg cmpltd)` = "Some college",
`I Tw yr cllg grdt (cmpltd 2 yrs cmmnty c` = "Some college",
`J Fr yr cllg grdt (cmpltd 4 yrs f cllg)` = "College graduate",
`K Post graduate (4 year college graduate` = "Post graduate")
class(survey$educ)
summary(survey$educ)
survey$educ <- as.ordered(survey$educ)
## Income
summary(survey$F4)
survey$income <- survey$F4
summary(survey$income)
class(survey$income)
## Age
summary(survey$Q1D)
survey$age <- survey$Q1D
summary(survey$age)
## race
summary(survey$F6)
survey$race <- survey$F6
summary(survey$race)
## politics
summary(survey$Q1C)
survey$party <- survey$Q1C
## ideology
summary(survey$Q1K)
survey$ideology <- survey$Q1K
summary(survey$ideology)
## gender
summary(survey$F7)
survey$gender <- survey$F7
table(survey$gender)
## religion
survey$religion <- survey$F5
summary(survey$religion)
### put together data set
survey_2624A1 <- survey[,c("pid", "study", "year", "urban", "region", "hh",
"inequality", "inequality.variable", "union.self", "union.other",
"employed", "occupation", "hhsize", "educ", "income",
"age", "race", "party", "ideology", "gender", "religion")]
summary(survey_2424A1)
summary(survey_2624A1)
